import { HTTP } from '../utils/http.js'

class StoreHttp extends HTTP { 
  // 商品分类
  getGoodsCategory (data) {
    return this.request({
      url: 'yddgoods/YddGoodsCategroyV2',
      method: 'POST',
      data: data
    })
  }

  // 商品列表
  getGoodsList (data) {
    return this.request({
      url: 'yddgoods/YddGoodsListV2',
      method: 'POST',
      data: data,
      isShowLoading: false
    })
  }

   // 获取门店相关信息
  getStoreInfo (data) {
    return this.request({
      url: 'yddgoods/GetStoreInfoV2',
      method: 'POST',
      data
    })
  }

  // 获取店铺购物车列表
  getStoreCartList (data) {
    return this.request({
      url: 'cart/find/list',
      method: 'POST',
      data: data,
      isJavaRequest: true
    })
  }

  // 添加商品数量到店铺购物车
  addGoodsNumToStoreCart (data) {
    return this.request({
      url: 'cart/add',
      method: 'POST',
      data: data,
      isJavaRequest: true
    })
  }

  // 修改店铺购物车数量
  addGoodsToStoreCart (data) {
    return this.request({
      url: 'cart/add/on',
      method: 'POST',
      data: data,
      isJavaRequest: true
    })
  }

  compoundGoodsPoster (data) {
    return this.request({
      url: 'wxgroup/WxGoodsPoster',
      method: 'POST',
      data: data
    })
  }

  // 添加商品到购物车
  addCartGoods (data) {
    return this.request({
      url: 's/yddgoods/YddMyCartAdd',
      method: 'POST',
      data: data,
      isShowLoading: false
    })
  }

  // 购物车列表
  getCartList (data) {
    return this.request({
      url: 's/yddgoods/YddMyCartGetV2',
      method: 'POST',
      data: data
    })
  }

  // 购物车删除商品
  deleteCartGoods (data) {
    return this.request({
      url: 's/yddgoods/YddMyCartDel',
      method: 'POST',
      data: data
    })
  }

  // 购物车数量修改
  changeGoodsNum (data) {
    return this.request({
      url: 's/yddgoods/YddMyCartUpdate',
      method: 'POST',
      data: data
    })
  }

  // 计算购物车优惠信息
  calculateCartDiscounts (data) {
    return this.request({
      isJavaRequest: true,
      url: 'order/discount',
      method: 'POST',
      data: data,
      isShowLoading: false
    })
  }
}

export { StoreHttp }
